//This script produces Figure 2 in section 1 of the Cambridge Element

//We used Stata/SE 18.0 for Mac (Intel 64-bit), Revision 25 Apr 2023

//Load ISSP data
use "issp_1985-2016.dta", clear

//Generate country label
gen country_lab = ""
replace country_lab = "Australia" if country == 36
replace country_lab = "Canada" if country == 124
replace country_lab = "Chile" if country == 152
replace country_lab = "Taiwan" if country == 158
replace country_lab = "Croatia" if country == 191
replace country_lab = "Denmark" if country == 208
replace country_lab = "Finland" if country == 246
replace country_lab = "France" if country == 250
replace country_lab = "Germany" if country == 276
replace country_lab = "Hungary" if country == 348
replace country_lab = "Ireland" if country == 372
replace country_lab = "Italy" if country == 380
replace country_lab = "Japan" if country == 392
replace country_lab = "South Korea" if country == 410
replace country_lab = "Latvia" if country == 428
replace country_lab = "New Zealand" if country == 554
replace country_lab = "Norway" if country == 578
replace country_lab = "Philippines" if country == 608
replace country_lab = "Poland" if country == 616
replace country_lab = "Slovakia" if country == 703
replace country_lab = "Slovenia" if country == 705
replace country_lab = "South Africa" if country == 710
replace country_lab = "Spain" if country == 724
replace country_lab = "Sweden" if country == 752
replace country_lab = "Switzerland" if country == 756
replace country_lab = "United States" if country == 840
replace country_lab = "Great Britain" if country == 82601 //Excludes Northern Ireland

//Rename variables
drop country 
rename country_lab country
rename year_sdno year

//Recode variables
recode v65 (-9 -8 -3 = .) (1 = 5) (2 = 4) (3 = 3) (4 = 2) (5 = 1), gen(mps_promises)

//Collapse to TSCS level
collapse (mean) mps_promises [aweight = WEIGHT], by(country year)
drop if country == ""
drop if country == "Italy"
drop if year == 1990
drop if year == 1985

//Plot whether MPs hold their promises over time and save as Figure 2
twoway (connected mps_promises year), by(country, note("")) xtitle("Year") ytitle("MPs try to keep their promises") scheme(lean2) subtitle(, size(large))
graph export "Figure2.png", width(2500) replace
